package com.ws.util;

import com.github.pagehelper.Page;
import com.ws.common.PaasPage;
import com.ws.common.PaasPageHelper;
import org.springframework.data.domain.Pageable;


/**
 * @author ：ws
 * @date ：Created in 2020/8/11 16:59
 * @description：TODO
 * @modified By：
 * @version: 1.0.0
 */
public class PageUtil {
    public static void setPageAndOrderBy(Pageable pageable) {
        PaasPageHelper.startPage(pageable.getPageNumber(), pageable.getPageSize());
    }

    public static <T> PaasPage<T> transformPage(Page<T> page) {
        return new PaasPage(page.getResult(), page.getTotal(), page.getPageSize(), page.getPageNum());
    }
}